#pragma once
#include "../PocelainType.h"
#include "EKeyCode.h"
#include "Object.h"
POCELAIN_NAMESPACE_BEGIN
class IInput : public Ref
{
public:
    IInput(){};
    virtual ~IInput(){};
    enum ECursorState{
        Normal,
        Hidden,
        Disable
    };

    // state machine
    //  Up -> Pressd (one frame status )
    //  -> Down
    //  -> Released (on frame status)
    //  -> Up / or ->Pressd
    enum class EKeyState : uint8_t{
        Up,			// persistent state
        Pressed,		// instantaneous state
        Down,		// persistent state
        Released,	// instantaneous state
    };
    virtual void update()=0;

    virtual bool anyKey()=0;
    virtual bool getKey(EKeyCode code)=0;
    virtual bool getKeyDown(EKeyCode code)=0;
    virtual bool getKeyUp(EKeyCode code)=0;

    virtual bool getButton(std::string button)=0;
    virtual Real getAxis(std::string axis)=0;

    virtual Vector2 getMousePosition()=0;
    virtual Vector2 getMousePositionDelta()=0;
    virtual Vector2 getMouseScrollDelta()=0;
    virtual Vector2 getWindowSize()=0;

    virtual void setCursorState(ECursorState state){mCursorState=state;}
    virtual ECursorState getCursorState()const {return mCursorState;}

protected:
    ECursorState mCursorState = ECursorState::Normal;
};
POCELAIN_NAMESPACE_END
